package com.jimmy.medical.repository;

import com.jimmy.medical.entity.HospitalDepartment;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface DepartmentRepository extends JpaSpecificationExecutor<HospitalDepartment>, PagingAndSortingRepository<HospitalDepartment, Long> {

    @Query("select d from HospitalDepartment d left join d.hospital h where h.id=?1")
    public List<HospitalDepartment> findHospitalDepartmentByHospital(Long hospitalId);
}
